#!/bin/sh
dir=`pwd`
cd $dir
if [ X"$1" = X ]
then
    for i in `find ./ -maxdepth 1 -type d|grep -E "[0-9]$"`
    do
        echo $i
        tar zcvf ${i##*\/}.tgz ${i##*\/}
    done
else
    [ -d $1 ] || [ -f $1 ] && tar zcvf ${1/%\/}.tgz $1
fi
